<?PHP
class dz_login
{	
	var $dz_id ;
	var $dz_username ;
	var $dz_s;
	protected $login_user,$login_pass;
	
	function SetSession($dz_user,$dz_pwd)
	{
	session_register(); 

    $_SESSION["gdusername"] = $dz_user; 
   
    if(isset($_POST['remme'])) 
    { 
        //Add additional member to cookie array as per requirement 
        setcookie("gdusername", $_SESSION['dz_username'], time()+60*60*24*100, "/"); 
        setcookie("gdpassword", $_SESSION['dz_password'], time()+60*60*24*100, "/"); 
		
        return;   
	   return;
	}	
	}
	protected function Sqlexec($user, $password)
	{
		$sql =  "SELECT * FROM member WHERE " . 
				"username = $username AND " . 
				"password = $password";
		$result=mysql_query($sql);
		$count=mysql_num_rows($result);
		
		if($count == 1) 
			return  true; 
			else  return  false;

	}

	public function dz_singon($dz_user, $dz_password)
	{
	if (!empty($dz_user) || !empty($dz_password))
	{   
		$this->login_user = chuck_quate($dz_user);
		$this->login_pass = chuck_quate(md5('dz-count'.$dz_password));
		if(Sqlexec($this->login_user,$this->login_pass))
		{
			SetSession($this->login_user, $this->login_pass);
		}
		else 
		{		
			dz_error();	
		}
	}

	}
	
	
}

?>